<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN">
<html>
<head>
<title>Application Interaction</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta name="generator" content="Doc-O-Matic" />
    <meta http-equiv="Content-Style-Type" content="text/css" />
    <link rel="STYLESHEET" href="default.css" type="text/css" />

<script type="text/javascript" src="scripts.js"></script>
</head>
<body class="Element700" onload="onBodyLoadEx('frames.html', 'topic', '00727.html');" onmousedown="onBodyMouseDown();">

<!-- Begin Popups -->

<!-- End Popups -->

<!-- Begin Page Header -->
<div class="Element710" id="areafixed">
<div class="Element94">
<a href="01259.html" target="topic">System Service Libraries Help</a> &gt; <a href="00735.html" target="topic">File System Service Library Help</a> &gt; <a href="00739.html" target="topic">Using the Library</a> &gt; <a href="00733.html" target="topic">How the Library Works</a> &gt; <a href="00727.html" target="topic">Application Interaction</a></div>
<div class="Element92">
<table width="100%" cellspacing="0" cellpadding="0">
<tr><td width="25%">
<div class="Element1">
MPLAB Harmony Core Help</div>
</td><td width="25%">
<div class="Element2">
<a href="contents.html" target="tocidx">Contents</a> | <a href="00007.html" target="topic">Home</a></div>
</td><td width="25%">
<div class="Element90">
<a href="00733.html" target="topic">Previous</a> | <a href="00733.html" target="topic">Up</a> | <a href="00738.html" target="topic">Next</a></div>
</td><td width="25%">
<div class="Element96">
<a href="mailto:docerrors@microchip.com&subject=MPLAB Harmony Documentation Feedback (Topic ID: SYS FS Application Interaction Topic Title: Application Interaction)&body=Thank you for your feedback! Please include a description of your feedback, and indicate whether you are reporting an an error in the documentation or an enhancement.">Documentation Feedback</a><br> <a href="http://support.microchip.com" target="_blank">Microchip Support</a></div>
</td></tr></table><div class="Element5">
Application Interaction</div>
</div>
</div>

<!-- End Page Header -->

<!-- Begin Client Area -->
<div class="Element720" id="areascroll">
<div class="Element721">

<!-- Begin Page Content -->
<a name="PageContent"></a><div class="Element58">
<a name="4465736372697074696F6E"></a><div class="Element11">
<div class="Element10">
<p class="Element10">
The interaction of various layers is shown in the following figure. </p><p class="Element10" style="text-align: center;">
<img src="FS_figure_1.png" border="0" alt="" title="">&nbsp;</p>
<p class="Element10" style="text-align: center;">
<strong>Application Interaction with FS Framework</strong></p><p class="Element10">
In the process of using the FS Framework, the application must first <strong>mount</strong> the media drive for the FS Framework to access the media. Unless the mounting process returns successfully, the application should continue trying to mount the drive. If the drive is not attached, the mounting process will fail. In such a situation, the application should not proceed further unless the mounting is success.&nbsp;</p>
<p class="Element10">
&nbsp;</p><p class="Element10" style="text-align: center;">
<img src="FS_figure_2.png" border="0" alt="" title="">&nbsp;</p>
<p class="Element10" style="text-align: center;">
<strong>Application Mounts a Formatted Drive</strong>&nbsp;</p>
<p class="Element10" style="text-align: center;">
&nbsp;</p>
<p class="Element10" style="text-align: center;">
&nbsp;</p><p class="Element10">
If the Drive to be mounted is Unformatted (<strong>No File system</strong>) then the application needs to format the drive using <strong><a href="00906.html" target="topic">SYS_FS_DriveFormat</a>()</strong> once the <a href="01117.html" target="topic">SYS_FS_Mount</a>() returns success. The application can make use of <strong><a href="00911.html" target="topic">SYS_FS_Error</a>()</strong> API to check if the mount was successful with no file system on the drive.&nbsp;</p>
<p class="Element10">
&nbsp;</p><p class="Element10" style="text-align: center;">
<img src="FS_figure_mount_format.png" border="0" alt="" title="">&nbsp;</p><p class="Element10">
&nbsp;</p>
<p class="Element10" style="text-align: center;">
<strong>Application Mounts a Un-Formatted Drive</strong></p><p class="Element10">
&nbsp;</p>
<p class="Element10">
Once the drive is mounted, the application code can then <strong>open the file</strong> from the drive with different attributes (such as read-only or write). If the file open returns a valid handle, the application can proceed further. Otherwise, the application will enter an error state. The reason for an invalid handle could be that the application was trying to read a file from the drive that does not exist. Another reason for an invalid handle is when the application tries to write to a drive that is write-protected.&nbsp;</p>
<p class="Element10">
Once the file is opened, the valid file handle is further used to <strong>read/write</strong> data to the file. Once the required operation is performed on the file, the file can then be <strong>closed</strong> by the application by passing the file handle. The following figure illustrates the process. </p><p class="Element10" style="text-align: center;">
&nbsp;</p>
<p class="Element10" style="text-align: center;">
<img src="FS_figure_3.png" border="0" alt="" title="">&nbsp;</p>
<p class="Element10" style="text-align: center;">
<strong>Further File System Operations</strong>&nbsp;</p></div>
</div>
</div>
<!-- End Page Content -->

<!-- Begin Page Footer -->
<div class="Element95">
<a href="01259.html" target="topic">System Service Libraries Help</a> &gt; <a href="00735.html" target="topic">File System Service Library Help</a> &gt; <a href="00739.html" target="topic">Using the Library</a> &gt; <a href="00733.html" target="topic">How the Library Works</a> &gt; <a href="00727.html" target="topic">Application Interaction</a></div>
<div class="Element93">
<table width="100%" cellspacing="0" cellpadding="0">
<tr><td width="25%">
<div class="Element3">
MPLAB Harmony Core Help</div>
</td><td width="25%">
<div class="Element4">
<a href="contents.html" target="tocidx">Contents</a> | <a href="00007.html" target="topic">Home</a></div>
</td><td width="25%">
<div class="Element91">
<a href="00733.html" target="topic">Previous</a> | <a href="00733.html" target="topic">Up</a> | <a href="00738.html" target="topic">Next</a></div>
</td><td width="25%">
<div class="Element97">
<a href="mailto:docerrors@microchip.com&subject=MPLAB Harmony Documentation Feedback (Topic ID: SYS FS Application Interaction Topic Title: Application Interaction)&body=Thank you for your feedback! Please include a description of your feedback, and indicate whether you are reporting an an error in the documentation or an enhancement.">Documentation Feedback</a><br> <a href="http://support.microchip.com" target="_blank">Microchip Support</a></div>
</td></tr></table></div>

<!-- End Page Footer -->
</div>
</div>

<!-- End Client Area -->
</body></html>